﻿using System;
using System.Reflection.Emit;
using JetBrains.Annotations;

namespace MugenInjection.Interception.Interface
{
    /// <summary>
    /// Represents the interface for creating a proxy.
    /// </summary>
    public interface IProxyBuilder
    {
        /// <summary>
        /// Gets the name of the parameter for the <see cref="IProxyCollection"/> used in a constructor.
        /// </summary>
        string ConstructorParameterName { get; }

        /// <summary>
        /// Gets or sets a module that uses a proxy.
        /// </summary>
        ModuleBuilder DynamicModule { get; set; }

        /// <summary>
        /// Creates a proxy type.
        /// </summary>
        /// <param name="baseType">The specified base type for proxy.</param>
        /// <param name="interfaces">Ths specified interfaces for include to proxy.</param>
        /// <param name="proxyCollection">The result <see cref="IProxyCollection"/>.</param>
        /// <returns>A proxy type.</returns>
        Type CreateProxy(Type baseType, Type[] interfaces,
                          out IProxyCollection proxyCollection);

        /// <summary>
        /// Gets the proxy constructor types match the original types.
        /// </summary>
        /// <param name="originalTypes">The specified original types.</param>
        /// <returns>The proxy types.</returns>
        Type[] GetProxyConstructorTypes(Type[] originalTypes);
    }
}